<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
   
  <meta name="keywords" content="The-Lonely-Wandeer,小和尚,blog" />
   
  <meta name="description" content="The-Lonely-Wandrer(小和尚)个人blog" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    linux-mysql |  The-Lonely-Wanderer
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
  
<link rel="stylesheet" href="/css/main.css">

  
  <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
  
  

  

</head>

</html>

<body>
  <div id="app">
    <main class="content">
      <section class="outer">
  <article id="post-linux-mysql" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  linux-mysql
</h1>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/03/12/linux-mysql/" class="article-date">
  <time datetime="2020-03-12T04:40:06.000Z" itemprop="datePublished">2020-03-12</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/linux/">linux</a>
  </div>

      
      
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">1.3k字</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">5分钟</span>
        </span>
    </span>
</div>

      
    </div>
    

    
    
    <div class="tocbot"></div>





    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="Ubuntu-系统-安装mysql-笔记"><a href="#Ubuntu-系统-安装mysql-笔记" class="headerlink" title="Ubuntu 系统 安装mysql 笔记"></a>Ubuntu 系统 安装mysql 笔记</h2><blockquote>
<h4 id="操作系统"><a href="#操作系统" class="headerlink" title="操作系统"></a>操作系统</h4><blockquote>
<p>Linux VM-0-14-ubuntu 4.15.0-54-generic</p>
</blockquote>
</blockquote>
<blockquote>
<h4 id="mysql-版本"><a href="#mysql-版本" class="headerlink" title="mysql 版本"></a>mysql 版本</h4><blockquote>
<p>mysql-server-5.7</p>
</blockquote>
</blockquote>
<a id="more"></a>
<h3 id="1、安装之前查看系统是否有默认安装的mysql版本"><a href="#1、安装之前查看系统是否有默认安装的mysql版本" class="headerlink" title="1、安装之前查看系统是否有默认安装的mysql版本"></a>1、安装之前查看系统是否有默认安装的mysql版本</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">mysql 指服务名称</span></span><br><span class="line">dpkg --list|grep mysql</span><br></pre></td></tr></table></figure>

<p>例</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">ubuntu@VM-0-14-ubuntu:/var$ dpkg --list|grep mysql</span><br><span class="line">ii  mysql-client     			  5.7.29-0ubuntu0.18.04.1         all	   ...</span><br><span class="line">ii  mysql-client-5.7       		  5.7.29-0ubuntu0.18.04.1        amd64     ...</span><br><span class="line">ii  mysql-client-core-5.7                 5.7.29-0ubuntu0.18.04.1         amd64    ...</span><br><span class="line">ii  mysql-common                          5.8+1.0.4                       all  	   ...</span><br><span class="line">ii  mysql-server                          5.7.29-0ubuntu0.18.04.1         all      ...</span><br><span class="line">ii  mysql-server-5.7                      5.7.29-0ubuntu0.18.04.1         amd64    ...</span><br><span class="line">ii  mysql-server-core-5.7                 5.7.29-0ubuntu0.18.04.1         amd64    ...</span><br></pre></td></tr></table></figure>

<h3 id="2、如果有可以先卸载"><a href="#2、如果有可以先卸载" class="headerlink" title="2、如果有可以先卸载"></a>2、如果有可以先卸载</h3><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment">#卸载 mysql 这里注意权限问题</span></span><br><span class="line"><span class="comment">#1.第一步，常规卸载</span></span><br><span class="line">	sudo apt-get <span class="keyword">purge</span> 软件名          //卸载软件</span><br><span class="line"><span class="comment">#2.第二步，清理一些不需要的文件（可以直接从第二步开始，autoremove后加软件名）</span></span><br><span class="line">	sudo apt-<span class="keyword">get</span> autoremove           //自动清理一些程序</span><br><span class="line">	<span class="comment">#或 </span></span><br><span class="line">	sudo apt-<span class="keyword">get</span> autoclean                </span><br><span class="line"><span class="comment">#3.第三步，删除不需要的配置文件 (软件名可以不传)</span></span><br><span class="line">	dpkg -l |grep ^rc|awk <span class="string">'&#123;print $2&#125;'</span> |sudo xargs dpkg -P （软件名）</span><br><span class="line"><span class="comment">#4.第四步，更新本地缓存</span></span><br><span class="line">	sudo apt-<span class="keyword">get</span> <span class="keyword">update</span>               //更新本地缓存文件</span><br><span class="line">	</span><br><span class="line"><span class="comment">#关于清楚配文件命令</span></span><br><span class="line"><span class="number">1</span>) dpkg -l</span><br><span class="line">       	列出系统中安装的所有包的状态，<span class="string">`ii' 开头的是正常安装的包，`</span>rc<span class="string">'开头的则是删除但仍留下配置文件的包</span></span><br><span class="line"><span class="string">	，其他状态则是有错误的状态，自己执行一次就明白了，输出结果的开头有说明的。</span></span><br><span class="line"><span class="string">   2) grep "^rc"</span></span><br><span class="line"><span class="string">       提取以 rc 开头的包，也就是被删除但仍残留配置文件的包的信息的行。</span></span><br><span class="line"><span class="string">   3) awk '</span>&#123;print $<span class="number">2</span>&#125;<span class="string">'</span></span><br><span class="line"><span class="string">       打印这些包的名字，他们位于 dpkg -l 输出结果的第二个字段，估计有很多人是通过这个命</span></span><br><span class="line"><span class="string">令认识到 awk 的，也有很多人只在这个命令行中才使用 awk，我就是其中之一。</span></span><br><span class="line"><span class="string">   4) xargs apt -y purge</span></span><br><span class="line"><span class="string">        把上述输出，也就是要清除配置文件的包的名字放在 apt -y purge 后面，purge命令会清除配置文件，</span></span><br><span class="line"><span class="string"> 而 -y 参数会自动对后面 apt 命令的提示回答是，这个开关通常是危险的，所以在一般情况下不要轻易使用，</span></span><br><span class="line"><span class="string"> 而在这里，如果你确定这些包的配置文件的清除是没有问题的的话，可以使用这个开关</span></span><br></pre></td></tr></table></figure>


<h3 id="3、卸载完成后开始安装（本次安装默认版本）"><a href="#3、卸载完成后开始安装（本次安装默认版本）" class="headerlink" title="3、卸载完成后开始安装（本次安装默认版本）"></a>3、卸载完成后开始安装（本次安装默认版本）</h3><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment">#安装 mysql-client mysql-server 中途会有一次交互 直接输入 Y 即可</span></span><br><span class="line">sudo apt-get <span class="keyword">install</span> mysql-<span class="keyword">client</span> mysql-<span class="keyword">server</span></span><br></pre></td></tr></table></figure>

<h3 id="4、安装完成后"><a href="#4、安装完成后" class="headerlink" title="4、安装完成后"></a>4、安装完成后</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash">查看服务启动状态，可用于判断是否安装成功</span></span><br><span class="line">service mysql status</span><br></pre></td></tr></table></figure>

<blockquote>
<p>启动状态        Active: active (running) </p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash">执行后查看 Active 是否为 running </span></span><br><span class="line">● mysql.service - MySQL Community Server</span><br><span class="line">  	 Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor 	 preset: enabled)</span><br><span class="line">  	 Active: active (running) since Wed 2020-03-11 15:12:27 CST; 11min ago</span><br><span class="line">  Main PID: 23154 (mysqld)</span><br><span class="line">     Tasks: 27 (limit: 2123)</span><br><span class="line">  	 CGroup: /system.slice/mysql.service</span><br><span class="line">          └─23154 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid</span><br><span class="line"> Mar 11 15:12:26 VM-0-14-ubuntu systemd[1]: Starting MySQL Community Server...</span><br><span class="line"> Mar 11 15:12:27 VM-0-14-ubuntu systemd[1]: Started MySQL Community Server.</span><br></pre></td></tr></table></figure>

<blockquote>
<p>未启动        Active: inactive (dead)</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">● mysql.service - MySQL Community Server</span><br><span class="line">   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)</span><br><span class="line">   Active: inactive (dead) since Wed 2020-03-11 15:29:55 CST; 16s ago</span><br><span class="line"> Main PID: 23154 (code=exited, status=0/SUCCESS)</span><br><span class="line">Mar 11 15:12:26 VM-0-14-ubuntu systemd[1]: Starting MySQL Community Server...</span><br><span class="line">Mar 11 15:12:27 VM-0-14-ubuntu systemd[1]: Started MySQL Community Server.</span><br><span class="line">Mar 11 15:29:54 VM-0-14-ubuntu systemd[1]: Stopping MySQL Community Server...</span><br><span class="line">Mar 11 15:29:55 VM-0-14-ubuntu systemd[1]: Stopped MySQL Community Server.</span><br></pre></td></tr></table></figure>

<h3 id="5、修改配置文件"><a href="#5、修改配置文件" class="headerlink" title="5、修改配置文件"></a>5、修改配置文件</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash">启动成功后，如果安装的时候有设置密码，可以尝试登陆，我这里需要先修改配置文件</span></span><br><span class="line"><span class="meta">#</span><span class="bash">进入到mysql配置文件默认的存放位置，查看可用于登陆的账户和密码</span></span><br><span class="line">cd /etc/mysql/</span><br><span class="line"><span class="meta">#</span><span class="bash">ls -l 可以看到一个文件 debin.cnf</span></span><br><span class="line">... 4096 Mar 11 15:12 conf.d</span><br><span class="line">...  317 Mar 11 15:12 debian.cnf</span><br><span class="line">...  120 Jan 21 22:10 debian-start</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash"> 进入文件找到user 和 password,这里需要用管理员权限打开，不然会是空白文档</span></span><br><span class="line">sudo vim debian.cnf</span><br></pre></td></tr></table></figure>

<h3 id="6、登陆mysql"><a href="#6、登陆mysql" class="headerlink" title="6、登陆mysql"></a>6、登陆mysql</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash">这里有一点，-h 和 -u 后面可以跟空格 但-p后面不能有空格，否则会被解析为数据库名</span></span><br><span class="line"><span class="meta">#</span><span class="bash">例：mysql -h 127.0.0.1 -u username -ppassword mysql(这里指登陆成功后直接使用mysql库)</span></span><br><span class="line">mysql -h 127.0.0.1 -u 用户名 -p密码</span><br></pre></td></tr></table></figure>

<h3 id="7、修改设置-允许远程连接-如果不需要可以不开启"><a href="#7、修改设置-允许远程连接-如果不需要可以不开启" class="headerlink" title="7、修改设置,允许远程连接(如果不需要可以不开启)"></a>7、修改设置,允许远程连接(如果不需要可以不开启)</h3><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment">--数据库修改</span></span><br><span class="line"><span class="keyword">update</span>  <span class="comment">-- 允许远程连接，默认值为loclhost(只允许本地连接)</span></span><br><span class="line">		<span class="keyword">user</span> <span class="keyword">set</span> host = <span class="string">'%'</span> , </span><br><span class="line">		<span class="comment">--将模式改为mysql_native_password 默认未 auth_socket </span></span><br><span class="line">	   	<span class="keyword">plugin</span> = <span class="string">'mysql_native_password'</span> , </span><br><span class="line">	   	<span class="comment">--密码设置，默认root账户为空密码</span></span><br><span class="line">	   authentication_string = <span class="keyword">PASSWORD</span>(<span class="string">'新密码'</span>) </span><br><span class="line"><span class="keyword">where</span> <span class="keyword">user</span> = <span class="string">'root'</span>;</span><br><span class="line"><span class="comment">-- 这里注意，host 和 plugin 要同时修改，否则无法远程连接</span></span><br></pre></td></tr></table></figure>

<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash">mysql 配置文件修改</span></span><br><span class="line">cd /etc/mysql/mysql.conf.d/</span><br><span class="line"><span class="meta">#</span><span class="bash">打开 mysql.cnf</span></span><br><span class="line">mysqld.cnf  mysqld_safe_syslog.cnf</span><br><span class="line"><span class="meta">#</span><span class="bash">修改	</span></span><br><span class="line">bind-address = 127.0.0.1 ---&gt; bind-address = 0.0.0.0</span><br><span class="line"><span class="meta">#</span><span class="bash">重启mysql</span></span><br><span class="line">service mysql restart</span><br></pre></td></tr></table></figure>

<h3 id="8、远程连接服务器mysql"><a href="#8、远程连接服务器mysql" class="headerlink" title="8、远程连接服务器mysql"></a>8、远程连接服务器mysql</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">配置到此便可以远程连接服务器的数据库了</span><br></pre></td></tr></table></figure>

<h3 id="9、结尾"><a href="#9、结尾" class="headerlink" title="9、结尾"></a>9、结尾</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">连接成功后建议使用工具把root用户的修改还原，并使用新建的用户连接使用，</span><br><span class="line">酌情处理初始账户debian_sys_maint;</span><br></pre></td></tr></table></figure>

      
      <!-- reward -->
      
    </div>
    
    
      <!-- copyright -->
      
        <div class="declare">
          <ul class="post-copyright">
            <li>
              <i class="ri-copyright-line"></i>
              <strong>版权声明： </strong s>
              本博客所有文章除特别声明外，均采用 <a href="https://www.apache.org/licenses/LICENSE-2.0.html" rel="external nofollow"
                target="_blank">Apache License 2.0</a> 许可协议。转载请注明出处！
            </li>
          </ul>
        </div>
        
    <footer class="article-footer">
      
          
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=http://the-lonely-wanderer.gitee.io/2020/03/12/linux-mysql/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/linux-mysql-%E5%AE%89%E8%A3%85/" rel="tag">linux mysql 安装</a></li></ul>


    </footer>

  </div>

  
  
  <nav class="article-nav">
    
      <a href="/2020/03/26/IE-%E6%B5%8F%E8%A7%88%E5%99%A8%E6%97%B6%E5%B7%AE/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            IE 浏览器时差
          
        </div>
      </a>
    
    
  </nav>


  

  
  
<!-- valine评论 -->
<div id="vcomments-box">
    <div id="vcomments">
    </div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js'></script>
<script>
    new Valine({
        el: '#vcomments',
        app_id: '',
        app_key: '',
        path: window.location.pathname,
        notify: 'false',
        verify: 'true',
        avatar: 'mp',
        placeholder: '给我的文章加点评论吧~',
        recordIP: true
    });
    const infoEle = document.querySelector('#vcomments .info');
    if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
        infoEle.childNodes.forEach(function (item) {
            item.parentNode.removeChild(item);
        });
    }
</script>
<style>
    #vcomments-box {
        padding: 5px 30px;
    }

    @media screen and (max-width: 800px) {
        #vcomments-box {
            padding: 5px 0px;
        }
    }

    #vcomments-box #vcomments {
        background-color: #fff;
    }

    .v .vlist .vcard .vh {
        padding-right: 20px;
    }

    .v .vlist .vcard {
        padding-left: 10px;
    }
</style>

  

  
  
<div class="gitalk" id="gitalk-container"></div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1.6.2/dist/gitalk.css">


<script src="https://cdn.jsdelivr.net/npm/gitalk@1.6.2/dist/gitalk.min.js"></script>


<script src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.10.0/js/md5.min.js"></script>

<script type="text/javascript">
  var gitalk = new Gitalk({
    clientID: '371faa36e8d4f35ab922',
    clientSecret: 'd8fb7d8f4554ce72d078243c4924d58c30bc94d5',
    repo: 'The-Lonely-Wanderer.github.io',
    owner: 'The-Lonely-Wanderer',
    admin: ['The-Lonely-Wanderer'],
    // id: location.pathname,      // Ensure uniqueness and length less than 50
    id: md5(location.pathname),
    distractionFreeMode: false,  // Facebook-like distraction free mode
    pagerDirection: 'last'
  })

  gitalk.render('gitalk-container')
</script>

  

</article>
</section>
      <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        &copy;
        2015-2020
        小和尚
      </li>
      <li>
        
        Powered by
        
        
        <a href="https://hexo.io" target="_blank">Hexo</a> Theme <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
        
      </li>
    </ul>
    <ul class="list-inline">
      <li>
        
        
        <span>
  <i>PV:<span id="busuanzi_value_page_pv"></span></i>
  <i>UV:<span id="busuanzi_value_site_uv"></span></i>
</span>
        
      </li>
      
      <li>
        <!-- cnzz统计 -->
        
      </li>
    </ul>
  </div>
</footer>
      <div class="to_top">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
      </div>
    </main>
    <aside class="sidebar">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/avatar.jpg" alt="The-Lonely-Wanderer"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/2019/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i></p>
  <div class="reward-box">
    
    
  </div>
</div>
    
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/share.js"></script>


<script src="/js/lazyload.min.js"></script>


<script>
  try {
    var typed = new Typed("#subtitle", {
      strings: ['面朝大海，春暖花开', '愿你一生努力，一生被爱', '想要的都拥有，得不到的都释怀'],
      startDelay: 0,
      typeSpeed: 200,
      loop: true,
      backSpeed: 100,
      showCursor: true
    });
  } catch (err) {
  }

</script>




<script src="/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: 'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
    onClick: (e) => {
      $('.toc-link').removeClass('is-active-link');
      $(`a[href=${e.target.hash}]`).addClass('is-active-link');
      $(e.target.hash).scrollIntoView();
      return false;
    }
  });
</script>



<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/js/ayer.js"></script>



<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>




<script src="/js/busuanzi-2.3.pure.min.js"></script>



<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>


<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.2/dist/jquery.fancybox.min.css">
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.2/dist/jquery.fancybox.min.js"></script>


    
    
<style>
    #music {
        position: fixed;
        right: 15px;
        bottom:-175px;
        z-index: 998;
        transition:0.5s;
    }
</style>

<div id="music">
    
    
    
    <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width="300" height="270" 
        src="//music.163.com/outchain/player?type=0&id=2455677284&auto=1&height=430"></iframe>
</div>

<script type="text/javascript">
    var music = document.getElementById("music");
    music.onmouseenter=function(){
        this.style.bottom="0px";
    }
    music.onmouseleave=function(){
        this.style.bottom="-175px";
    }
    window.onload =function(){
        console.clear();
        console.log("                          _ooOoo_                              "+"\n "+
                    "                         o8888888o                             "+"\n "+
                    "                         88 "+" . "+" 88                       "+"\n "+
                    "                         (| ^_^ |)                             "+"\n "+
                    "                         O\  =  /O                             "+"\n "+
                    "                      ____/`---'\____                          "+"\n "+
                    "                    .'  \\|     |//  `.                        "+"\n "+
                    "                   /  \\|||  :  |||//  \                       "+"\n "+
                    "                  /  _||||| -:- |||||-  \                      "+"\n "+
                    "                  |   | \\\  -  /// |   |                      "+"\n "+
                    "                  | \_|  ''\---/''  |   |                      "+"\n "+
                    "                  \  .-\__  `-`  ___/-. /                      "+"\n "+
                    "                ___`. .'  /--.--\  `. . ___                    "+"\n "+
                    "              .`` '<  `.___\_<|>_/___.'  >'``.                 "+"\n "+
                    "            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                "+"\n "+
                    "            \  \ `-.   \_ __\ /__ _/   .-` /  /                "+"\n "+
                    "      ========`-.____`-.___\_____/___.-`____.-'========        "+"\n "+
                    "                           `=---='                             "+"\n "+
                    "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"+"\n "+
                    "||             佛祖保佑       永不宕机      永无BUG            ||"+"\n "+
                    "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
                            );
    }
</script>
    
  </div>
</body>

</html>